@echo off
set PROJECT_DIR=%cd%
if "%1"=="config" (
	call %PROJECT_DIR%\make\config.bat
) else if "%1"=="clean" (
	call %PROJECT_DIR%\make\clean.bat
) else if "%1"=="debug" (
	call %PROJECT_DIR%\make\debug.bat
) else if "%1"=="release" (
	REM This mode is building
	if "%2"=="" (
		REM call %PROJECT_DIR%\make\release.bat
	) else if "%2"=="device" (
		REM call %PROJECT_DIR%\make\release.bat %2
	) else (
		REM goto ERROR
	)
) else if "%1"=="uninstall" (
	if "%2"=="" (
		call %PROJECT_DIR%\make\uninstall.bat
	) else if "%2"=="device" (
		call %PROJECT_DIR%\make\uninstall.bat %2
	) else (
		goto ERROR
	)
) else if "%1"=="install" (
	if "%2"=="" (
		call %PROJECT_DIR%\make\install.bat
	) else if "%2"=="device" (
		call %PROJECT_DIR%\make\install.bat %2
	) else (
		goto ERROR
	)
) else if "%1"=="run" (
	if "%2"=="" (
		call %PROJECT_DIR%\make\run.bat
	) else if "%2"=="device" (
		call %PROJECT_DIR%\make\run.bat %2
	) else (
		goto ERROR
	)
) else if "%1"=="all" (
	if "%2"=="" (
		call %PROJECT_DIR%\make\all.bat
	) else if "%2"=="device" (
		call %PROJECT_DIR%\make\all.bat %2
	) else (
		goto ERROR
	)
) else (
	goto ERROR
)
goto END
:ERROR
	echo.
	echo parameter of make.bat is one of
	echo      config     		: config environment variable
	echo      clean     		: clean all project
	echo      debug     		: compile project with debug mode
	echo      release   		: compile project with release mode
	echo      uninstall 		: remove installed package on simulator
	echo      uninstall device	: remove installed package on connected device
	echo      install   		: install new package on simulator
	echo      install device	: install new package on connected device
	echo      run              	: open installed package on simulator
	echo      run device		: open installed package on connected device
	echo      all       		: build project with debug mode, install and run on simulator
	echo      all device       	: build project with debug mode, install and run on connected device	
	echo.
:END